﻿<Window x:Class="CommunityBridge2.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:l="clr-namespace:CommunityBridge2"
        Title="Community Forums NNTP Bridge 2" Height="600" Width="500" Icon="/CommunityBridge2;component/Resources/CommunityBridge2.ico">
    <Window.CommandBindings>
        <CommandBinding Command="ApplicationCommands.Close" Executed="OnCloseExecute" CanExecute="OnCanCloseExecute" />
        <CommandBinding Command="{x:Static l:MainWindow.Info}" Executed="OnInfoExecute" CanExecute="OnCanInfoExecute" />
        <CommandBinding Command="{x:Static l:MainWindow.Options}" Executed="OnOptionsExecute" CanExecute="OnCanOptionsExecute" />
    <CommandBinding Command="{x:Static l:MainWindow.Logout}" Executed="OnLogoutExecute" CanExecute="OnCanLogoutExecute" />
    <CommandBinding Command="{x:Static l:MainWindow.SendDebugFiles}" Executed="OnSendDebugFilesExecute" CanExecute="OnCanSendDebugFilesExecute" />
  </Window.CommandBindings>
    <Window.Background>
        <LinearGradientBrush EndPoint="1,0.5" StartPoint="0,0.5">
            <GradientStop Color="#FFCDBE9D" Offset="0" />
            <GradientStop Color="Cornsilk" Offset="1" />
        </LinearGradientBrush>
    </Window.Background>
    <Window.Resources>
        <ResourceDictionary>
      <DataTemplate DataType="{x:Type l:NewsgroupAnswers}">
        <Border Background="LightBlue" BorderBrush="Black" BorderThickness="1" CornerRadius="5">
          <Grid >
            <Grid.ColumnDefinitions>
              <ColumnDefinition Width="5*" />
              <ColumnDefinition Width="1*" />
            </Grid.ColumnDefinitions>
            <Grid.RowDefinitions>
              <RowDefinition />
              <RowDefinition />
            </Grid.RowDefinitions>
            <TextBlock Text="{Binding Name}" />
            <Button Grid.Column="1" Content="{Binding ActionText}" Command="{Binding Action}" />
            <TextBlock Text="{Binding Info}" Grid.ColumnSpan="2" Grid.Row="1" />
          </Grid>
        </Border>
      </DataTemplate>
    </ResourceDictionary>
    </Window.Resources>
    <DockPanel>
        <Menu DockPanel.Dock="Top" IsMainMenu="True" >
            <MenuItem Header="_File" >
                <MenuItem Header="E_xit" Command="ApplicationCommands.Close" />
            </MenuItem>
            <MenuItem Header="_Tools" >
                <!--<MenuItem Header="Create LiveId auto login..." x:Name="mnuCreateLiveAutoLogin" Click="mnuCreateLiveAutoLogin_Click" />
                <Separator />-->
                <MenuItem Header="Debug window..." IsCheckable="True" x:Name="mnuDebugWindow" Click="mnuDebugWindow_Click" />
                <MenuItem Header="Advanced _options..." Command="{x:Static l:MainWindow.Options}" />
        <MenuItem Header="Logout and Exit..." Command="{x:Static l:MainWindow.Logout}" />
      </MenuItem>
            <MenuItem Header="_Help" >
        <MenuItem Header="_Send debug files..." Command="{x:Static l:MainWindow.SendDebugFiles}" />
        <MenuItem Header="_Info" Command="{x:Static l:MainWindow.Info}" />
      </MenuItem>
        </Menu>

        <DockPanel DockPanel.Dock="Top">
            <StackPanel>
                <DockPanel Margin="5" LastChildFill="True">
                    <TextBlock VerticalAlignment="Center" DockPanel.Dock="Left">NNTP-Port: </TextBlock>
                    <TextBox x:Name="txtPort" Margin="5,0,0,0" MinWidth="50">119</TextBox>
                </DockPanel>
                <CheckBox Margin="5" x:Name="cbAutoStart" Click="CbAutoStartChecked">Auto start NNTP server</CheckBox>
                <CheckBox Margin="5" x:Name="cbAutoMinimize" Click="CbAutoMinimizeChecked">Auto minimize</CheckBox>
            </StackPanel>
            <StackPanel  VerticalAlignment="Center" >
              <CheckBox x:Name="cbUsePlainTextConverter" Click="cbUsePlainTextConverter_Click">Use plain/text converter
                    <CheckBox.ToolTip>If you enable this option, all messages from the forums will be converted into plain/text for your newsreader. 
                        Also it will convert messages that you sent via plain/text into html with support of some markus-language.
                        Thanks to Josef Poetze who implemented this feature!</CheckBox.ToolTip>
                </CheckBox>
            </StackPanel>
        </DockPanel>
        <DockPanel Margin="5" DockPanel.Dock="Top" LastChildFill="True">
            <TextBlock Margin="5">Info:</TextBlock>
            <TextBlock Margin="5" x:Name="lblInfo" TextWrapping="Wrap" Height="50" />
        </DockPanel>
        <Grid DockPanel.Dock="Top" MinHeight="120">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="2*" />
                <ColumnDefinition Width="1*" />
            </Grid.ColumnDefinitions>
            <Button Margin="20" x:Name="cmdStart" Click="CmdStartClick" FontSize="40">_Start</Button>
            <Button Grid.Column="1" Margin="20" x:Name="cmdExit"  Click="cmdExit_Click" FontSize="40">E_xit</Button>
        </Grid>
    <DockPanel DockPanel.Dock="Top" LastChildFill="True">
      <Button Margin="5"  DockPanel.Dock="Left" 
              x:Name="cmdLoadNewsgroupList" Click="CmdLoadNewsgroupListClick"
              IsEnabled="{Binding Started}" Content="Prefetch newsgroup list" />
      <TextBlock  Margin="5" x:Name="txtPrefetchInfo"></TextBlock>
    </DockPanel>
    <DockPanel DockPanel.Dock="Bottom" LastChildFill="True">
      <TextBlock>Search:</TextBlock>
      <TextBlock Text=" (" />
      <TextBlock Text="{Binding FilterInfo}" />
      <TextBlock Text="): " />
      <TextBox Text="{Binding NewsgroupSearchText, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
    </DockPanel>
    <ListBox ItemsSource="{Binding Newsgroups}" HorizontalContentAlignment="Stretch" IsEnabled="{Binding Started}" />
  </DockPanel>
</Window>
